Class that wraps all the methods of the ITextRow interface.
| Name | Description |
|---|---|
| CONSTRUCTORS | Called when a class variable is created. |
| DESTRUCTOR | Called automatically when a class variable goes out of scope or is destroyed. |
| LET | Assignment operator. |
| CAST | Cast operator. |
| TextRowPtr | Returns a pointer to the underlying ITextRow interface. |
| Attach | Attaches an ITextRow interface pointer to the class. |
| Detach | Detaches the underlying ITextRow interface pointer from the class. |
The ITextRow interface provides methods to insert one or more identical table rows, and to retrieve and change table row properties. To insert nonidentical rows, call Insert for each different row configuration.
The ITextRow interface inherits from the IDispatch interface. ITextRow also has these types of members:
| Name | Description |
|---|---|
| GetAlignment | Gets the horizontal alignment of a row. |
| SetAlignment | Sets the horizontal alignment of a row. |
| GetCellCount | Gets the count of cells in a row. |
| SetCellCount | Sets the count of cells in a row. |
| GetCellCountCache | Gets the count of cells cached for this row. |
| SetCellCountCache | Sets the count of cells cached for this row. |
| GetCellIndex | Gets the index of the active cell to get or set parameters for. |
| SetCellIndex | Sets the index of the active cell to get or set parameters for. |
| GetCellMargin | Gets the cell margin of this row. |
| SetCellMargin | Sets the cell margin of this row. |
| GetHeight | Gets the height of the row. |
| SetHeight | Sets the height of the row. |
| GetIndent | Gets the indent of this row. |
| SetIndent | Sets the indent of this row. |
| GetKeepTogether | Gets whether this row is allowed to be broken across pages. |
| SetKeepTogether | Sets whether this row is allowed to be broken across pages. |
| GetKeepWithNext | Gets whether this row should appear on the same page as the row that follows it. |
| SetKeepWithNext | Sets whether this row should appear on the same page as the row that follows it. |
| GetNestLevel | Gets the nest level of a table. |
| GetRTL | Gets whether this row has right-to-left orientation. |
| SetRTL | Sets whether this row has right-to-left orientation. |
| GetCellAlignment | Gets the vertical alignment of the active cell. |
| SetCellAlignment | Sets the vertical alignment of the active cell. |
| GetCellColorBack | Gets the background color of the active cell. |
| SetCellColorBack | Sets the background color of the active cell. |
| GetCellColorFore | Gets the foreground color of the active cell. |
| SetCellColorFore | Sets the foreground color of the active cell. |
| GetCellMergeFlags | Gets the merge flags of the active cell. |
| SetCellMergeFlags | Sets the merge flags of the active cell. |
| GetCellShading | Gets the shading of the active cell. |
| SetCellShading | Sets the shading of the active cell. |
| GetCellVerticalText | Gets the vertical-text setting of the active cell. |
| SetCellVerticalText | Sets the vertical-text setting of the active cell. |
| GetCellWidth | Gets the width of the active cell. |
| SetCellWidth | Sets the width of the active cell. |
| GetCellBorderColors | Gets the border colors of the active cell. |
| GetCellBorderWidths | Gets the border widths of the active cell. |
| SetCellBorderColors | Sets the border colors of the active cell. |
| SetCellBorderWidths | Sets the border widths of the active cell. |
| Apply | Applies the formatting attributes of this text row object to the specified rows in the associated ITextRange2. |
| CanChange | Determines whether changes can be made to this row. |
| GetProperty | Gets the value of the specified property. |
| Insert | Inserts a row, or rows, at the location identified by the associated ITextRange2 object. |
| IsEqual | Compares two table rows to determine if they have the same properties. |
| Reset | Resets a row. |
| SetProperty | Sets the value of the specified property. |
| Name | Description |
|---|---|
| GetLastResult | Returns the last result code |
| SetResult | Sets the last result code. |
| GetErrorInfo | Returns a description of the last result code. |
Called when a CTextRow class variable is created.
DECLARE CONSTRUCTOR
DECLARE CONSTRUCTOR (BYVAL pTextRow AS ITextRow PTR, BYVAL fAddRef AS BOOLEAN = FALSE)
Can be used, for example, when we have an ITextRow interface pointer returned by a function and we want to attach it to a new instance of the CTextRow class. To get a pointer to the ITextRow interface call the GetRow method of the CTextDocument2 class.
DIM pCTextRow AS CTextRow
pCTextRow.Attach(pTextRow)
CONSTRUCTOR CTextRow (BYVAL pTextRow AS ITextRow PTR, BYVAL fAddRef AS BOOLEAN = FALSE)
| Parameter | Description |
|---|---|
| pTextRow | An ITextRow interface pointer. |
| fAddRef | Optional. TRUE to increment the reference count of the passed ITextRow interface pointer; otherwise, FALSE. Default is FALSE. |
A pointer to the new instance of the class.
Called automatically when a class variable goes out of scope or is destroyed.
DESTRUCTOR CTextRow
Assignment operator. The assigned pointer must be an “addrefed” one.
OPERATOR LET (BYVAL pTextRow AS ITextRow PTR)
Cast operator.
OPERATOR CAST () AS ITextRow PTR
Returns a pointer to the underlying ITextRow interface
FUNCTION TextRowPtr () AS ITextRow PTR
Attaches an ITextRow interface pointer to the class.
FUNCTION Attach (BYVAL pTextRow AS ITextRow PTR, BYVAL fAddRef AS BOOLEAN = FALSE) AS HRESULT
| Parameter | Description |
|---|---|
| pTextRow | The ITextRow interface pointer to attach. |
| fAddRef | TRUE to increment the reference count of the object; otherwise, FALSE. Default is FALSE. |
+++
Detaches the interface pointer from the class
FUNCTION Detach () AS ITextRow PTR
Returns the last result code
FUNCTION GetLastResult () AS HRESULT
Sets the last result code.
FUNCTION SetResult (BYVAL Result AS HRESULT) AS HRESULT
| Parameter | Description |
|---|---|
| Result | The HRESULT error code returned by the methods. |
Returns a description of the last result code.
FUNCTION CTOMBase.GetErrorInfo () AS DWSTRING
IF SUCCEEDED(m_Result) THEN RETURN "Success"
DIM s AS DWSTRING = "Error &h" & HEX(m_Result, 8)
SELECT CASE m_Result
CASE E_POINTER : s += ": E_POINTER - Null pointer"
CASE S_OK : s += ": S_OK - Success"
CASE S_FALSE : s += ": S_FALSE - Failure"
CASE E_NOTIMPL : s += ": E_NOTIMPL - Not implemented."
CASE E_INVALIDARG : s += ": E_INVALIDARG - Invalid argument"
CASE E_OUTOFMEMORY : s += ": E_OUTOFMEMORY - Insufficient memory"
' CASE E_FILENOTFOUND : s += "E_FILENOTFOUND - File not found"
CASE &h80070002 : s += "E_FILENOTFOUND - File not found"
CASE E_ACCESSDENIED : s += "E_ACCESSDENIED - Access denied"
CASE E_FAIL : s += ": E_FAIL - Access denied"
CASE NOERROR : s += ": NOERROR - Success" '' (same as S_OK)
CASE CO_E_RELEASED: : s += ": CO_E_RELEASED: - The object has been released"
CASE ELSE
s += "Unknown error"
END SELECT
RETURN s
END FUNCTION
Gets the horizontal alignment of a row.
FUNCTION GetAlignment () AS LONG
The horizontal alignment. It can be one of the following values.
| Constant | Value | Meaning |
|---|---|---|
| tomAlignLeft | 0 | Text aligns with the left margin. |
| tomAlignCenter | 1 | Text is centered between the margins. |
| tomAlignRight | 2 | Text aligns with the right margin. |
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the horizontal alignment of a row.
FUNCTION SetAlignment (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The new horizontal alignment. It can be one of the following values. |
| Constant | Value | Meaning |
|---|---|---|
| tomAlignLeft | 0 | Text aligns with the left margin. |
| tomAlignCenter | 1 | Text is centered between the margins. |
| tomAlignRight | 2 | Text aligns with the right margin. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the count of cells in this row.
FUNCTION GetCellCount () AS LONG
The cell count for this row.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the count of cells in a row.
FUNCTION SetCellCount (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The row cell count. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the count of cells cached for this row.
FUNCTION GetCellCountCache () AS LONG
The cached cell count.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the count of cells cached for a row.
FUNCTION SetCellCountCache (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The row cell count. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
If all cells are identical, properties need to be cached only for the cell with index 0. If the cached count is less than the cell count, the cell parameters for index CellCountCache – 1 are used for cells with larger indices.
Gets the index of the active cell to get or set parameters for.
FUNCTION GetCellIndex () AS LONG
The cell index.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the index of the active cell.
FUNCTION SetCellIndex (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The cell index. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
You can get or set parameters for an active cell.
If the cell index is greater than the cell count, and the cell index is less that 63 (the maximum cell count), then the cell count is increased to cell index + 1.
Gets the cell margin of this row.
FUNCTION GetCellMargin () AS LONG
The cell margin.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the cell margin of a row.
FUNCTION SetCellMargin (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The cell margin. The cell margin is used for all cells in the row and is typically about 108 twips or 0.075 inches. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the height of the row.
FUNCTION GetHeight () AS LONG
The row height. A value of 0 indicates autoheight.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the cell margin of a row.
FUNCTION SetHeight (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The row height. A value of 0 indicates autoheight. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the indent of this row.
FUNCTION GetIndent () AS LONG
The indent of the row.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the indent of a row.
FUNCTION SetIndent (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The row indent. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets whether this row is allowed to be broken across pages.
FUNCTION GetKeepTogether () AS LONG
A tomBool value that indicates whether this row can be broken across pages.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets whether this row is allowed to be broken across pages.
FUNCTION SetKeepTogether (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | A tomBool value that indicates whether this row can be broken across pages. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets whether this row is allowed to be broken across pages.
FUNCTION GetKeepWithNext () AS LONG
A tomBool value that indicates whether this row can be broken across pages.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the nest level of a table.
FUNCTION GetNestLevel () AS LONG
| Parameter | Description |
|---|---|
| Value | The nest level. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
The nest level of the table is identified by the associated ITextRange2 object. If there is only a single table, the nest level is 1. If there is no table, the nest level is 0.
Gets whether this row has right-to-left orientation.
FUNCTION GetRTL () AS LONG
A tomBool value that indicates whether this row has right-to-left orientation.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets whether this row has right-to-left orientation.
FUNCTION SetRTL (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | A tomBool value that can be one of the following. |
| Value | Meaning |
|---|---|
| tomTrue | Right-to-left orientation. |
| tomFalse | Left-to-right orientation. |
| tomToggle | Toggles the orientation. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the vertical alignment of the active cell.
FUNCTION GetCellAlignment () AS LONG
The vertical alignment.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the vertical alignment of the active cell.
FUNCTION SetCellAlignment (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The vertical alignment. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the background color of the active cell.
FUNCTION GetCellColorBack () AS LONG
The background color.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the background color of the active cell.
FUNCTION SetCellColorBack (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The background color. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
See GetCellShading to see how the background color is used together with the foreground color.
Gets the foreground color of the active cell.
FUNCTION GetCellColorFore () AS LONG
Gets the foreground color of the active cell.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the foreground color of the active cell.
FUNCTION SetCellColorFore (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The foreground color. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
See GetCellShading to see how the foreground color is used together with the background color.
Gets the merge flags of the active cell.
FUNCTION GetCellMergeFlags () AS LONG
The merge flag of the active cell. The flag can be one of the following:
| Flag | Meaning |
|---|---|
| tomHContCell | Any cell except the start in a horizontally merged cell set. |
| tomHStartCell | The top cell in vertically merged cell set. |
| tomVLowCell | Any cell except the top cell in a vertically merged cell set. |
| tomVTopCell | The top cell in vertically merged cell set. |
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the merge flags of the active cell.
FUNCTION SetCellMergeFlags (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The merge flag. It can be one of these values. |
| Flag | Meaning |
|---|---|
| tomHContCell | Any cell except the start in a horizontally merged cell set. |
| tomHStartCell | The top cell in vertically merged cell set. |
| tomVLowCell | Any cell except the top cell in a vertically merged cell set. |
| tomVTopCell | The top cell in vertically merged cell set. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the shading of the active cell.
FUNCTION GetCellShading () AS LONG
The shading of the active cell. See Remarks.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
The shading is given in hundredths of a percent, so full shading is given by the value 10000. The shading percentage determines the mix of the cell foreground and background colors to be used for the cell background. A shading of 0 uses the cell background color alone. A shading of 10000 (100%) uses the foreground color alone. Values in between mix the foreground and background colors, weighting the background with (10000 – CellShading)/1000 and the foreground with CellShading/1000. These ratios are applied to the red, green, and blue channels independently of one another.
Sets the shading of the active cell.
FUNCTION SetCellShading (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The shading of the active cell. |
The shading is given in hundredths of a percent, so full shading is given by the value 10000. The shading percentage determines the mix of the cell foreground and background colors to be used for the cell background. A shading of 0 uses the cell background color alone. A shading of 10000 (100%) uses the foreground color alone. Values in between mix the foreground and background colors, weighting the background with (10000 – CellShading)/1000 and the foreground with CellShading/1000. These ratios are applied to the red, green, and blue channels independently of one another.
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the vertical-text setting of the active cell.
This property is not currently implemented.
FUNCTION GetCellVerticalText () AS LONG
The vertical-text setting.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the vertical-text setting of the active cell.
This property is not currently implemented.
FUNCTION SetCellVerticalText (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The vertical-text setting. |
Gets the width of the active cell.
FUNCTION GetCellWidth () AS LONG
The width of the active cell, in twips.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
The width of the cell, and/or the entire row, must be less than 22 inches (1440 x 22).
Sets the active cell width in twips.
FUNCTION SetCellWidth (BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The width of the active cell. |
The total width of the entire row must be less than 22 inches, or 1440×22.
Gets the border colors of the active cell.
FUNCTION GetCellBorderColors (BYVAL pcrLeft AS LONG PTR, BYVAL pcrTop AS LONG PTR, _
BYVAL pcrRight AS LONG PTR, BYVAL pcrBottom AS LONG PTR) AS HRESULT
| Parameter | Description |
|---|---|
| pcrLeft | The active-cell left border color. |
| pcrTop | The active-cell top border color. |
| pcrRight | The active-cell right border color. |
| pcrBottom | The active-cell bottom border color. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the border widths of the active cell.
FUNCTION GetCellBorderWidths (BYVAL pduLeft AS LONG PTR, BYVAL pduTop AS LONG PTR, _
BYVAL pduRight AS LONG PTR, BYVAL pduBottom AS LONG PTR) AS HRESULT
| Parameter | Description |
|---|---|
| pduLeft | The active-cell left border width. |
| pduTop | The active-cell top border width. |
| pduRight | The active-cell right border width. |
| pduBottom | The active-cell bottom border width. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the border colors of the active cell.
FUNCTION SetCellBorderColors (BYVAL crLeft AS LONG, BYVAL crTop AS LONG, _
BYVAL crRight AS LONG, BYVAL crBottom AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| crLeft | The left border color. |
| crTop | The top border color. |
| crRight | The right border color. |
| crBottom | The bottom border color. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Sets the border widths of the active cell.
FUNCTION SetCellBorderWidths (BYVAL duLeft AS LONG, BYVAL duTop AS LONG, _
BYVAL duRight AS LONG, BYVAL duBottom AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| duLeft | The left border width. |
| duTop | The top border width. |
| duRight | The right border width. |
| duBottom | The bottom border width. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Applies the formatting attributes of this text row object to the specified rows in the associated ITextRange2.
FUNCTION Apply (BYVAL cRow AS LONG, BYVAL Flags AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| cRow | The number of rows to apply this text row object to. |
| Flags | A flag that controls how the formatting attributes are applied. It can be one of the following values. |
| Value | Meaning |
|---|---|
| tomCellStructureChangeOnly | Apply formatting attributes only to cell widths or the cell count (enables you to change column widths or insert/delete columns without changing other properties, such as cell borders). |
| tomRowApplyDefault | Apply formatting attributes to the full application, not just cell widths and count. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Determines whether changes can be made to this row.
FUNCTION CanChange () AS LONG
A tomBool indicating whether the row can be edited. It is tomTrue only if the row can be edited.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Gets the value of the specified property.
FUNCTION GetProperty (BYVAL nType AS LONG) AS LONG
| Parameter | Description |
|---|---|
| nType | The ID of the property to retrieve. |
The value for the property.
If the method succeeds, GetLastResult returns NOERROR. Otherwise, it returns an HRESULT error code.
Inserts a row, or rows, at the location identified by the associated ITextRange2 object.
FUNCTION Insert (BYVAL cRow AS LONG) AS HRESULT
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Compares two table rows to determine if they have the same properties.
FUNCTION IsEqual (BYVAL pRow AS ITextRow PTR) AS LONG
| Parameter | Description |
|---|---|
| pRow | The row to compare to. |
The comparison result: tomTrue if equal, and tomFalse if not.
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
Resets a row.
FUNCTION Reset (BYVAL Value AS LONG = tomRowUpdate) AS HRESULT
| Parameter | Description |
|---|---|
| Value | The **tomRowUpdate reset value: Update the row to have the properties of the table row identified by the associated text range. |
If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.
| Result code | Description |
|---|---|
| E_ACCESSDENIED | Write access is denied. |
| E_OUTOFMEMORY | Insufficient memory. |
Sets the value of the specified property.
FUNCTION SetProperty (BYVAL nType AS LONG, BYVAL Value AS LONG) AS HRESULT
| Parameter | Description |
|---|---|
| nType | The ID of the property to set. |
| Value | The value to set. |
If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.